package com.jml.aop.jdk动态代理;

import com.jml.aop.jdk动态代理.spring.UserService;
import com.jml.aop.jdk动态代理.spring.UserServiceImpl;

import java.lang.reflect.Proxy;

public class MainTest {
	public static void main(String[] args) {
		UserService userService = new UserServiceImpl();
		MyInvocationHandler myInvocationHandler = new MyInvocationHandler(userService);
		UserService proxy = (UserService)Proxy.newProxyInstance(
				Thread.currentThread().getContextClassLoader(),
				userService.getClass().getInterfaces(),
				myInvocationHandler);
//		UserService proxy = (UserService)myInvocationHandler.getProxy();
		proxy.add();
	}
}
